﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Web;
using System.Net;
using System.IO;
using System.Collections;
using System.Timers;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Windows.Threading;
using log4net;
using Newtonsoft.Json;
//using WPF.Themes;
namespace BallData
{
     
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    /// 
    
    public partial class Window1 : Window, MainUIControl
    {
        private Timer timer = new Timer();
        private LogBoxList logList = new LogBoxList();

        private log4net.ILog log = log4net.LogManager.GetLogger(typeof(Window1));

        private List<IListenCompany> listencompanys = new List<IListenCompany>();

        private List<IListenMatchItem> listenmatchitems = new List<IListenMatchItem>();

        private List<IListenFilter> listenmatchfilter = new List<IListenFilter>();

        

        private ShowAllCompanyLogic logicshowallcompany;
        private ShowMathItemLogic logicshowmathitems;
        private ShowMathItemForCaiPiao logicshowmathcaipiao;

        private FilterOdds filterodds;
        private FilterHistoryVS filterhisvs;
        private FilterLeagueData filterleaguedata;
        private FilterCloseVS filterclosevs;
        private Match_Filters wnd = new Match_Filters();
        public LogBoxList LogList
        {
            get { return logList; }
            set { logList = value; }
        }

        
        public Window1()
        {
            InitializeComponent();

        }
        public void getoddsbycompany(String cid)
        {

        }

 
        private void button1_Click(object sender, RoutedEventArgs e)
        {

            foreach (TabItem tb in this.LeagueTab.Items)
            {

                ListView lv = tb.Content as ListView;



                ObservableCollection<MatchListDataTemple> matchlist = lv.ItemsSource as ObservableCollection<MatchListDataTemple>;


                if (matchlist == null)
                {
                    continue;
                }
                foreach (MatchListDataTemple md in matchlist)
                {
                    md.Odds_a_host_color = "#DF01D7";

                }
            }
  
            
           

 
        }
        // 定时获取赔率改变数据
        private void timer1_Tick(object sender, EventArgs e)
        {

            Action action = Gooooal_NetDataHelper.GetOddsChg;

            action.BeginInvoke(Gooooal_NetDataHelper.OnGetMatOddsChgDataOk, action);

            UpdateFilterMatchs();

            this.StopTimeTick();

        }
        public void ShowMatchOddsWnd(String mId)
        {
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start(); //  开始监视代码运行时间
            MatchOddsWnd2 wnd = new MatchOddsWnd2();
            wnd.InitData(Gooooal_NetDataHelper.matchdataobj, mId);
            wnd.InitUI();
            stopwatch.Stop(); //  停止监视
            
            Console.WriteLine("cost time:{0}",stopwatch.Elapsed.TotalMilliseconds);
            
            wnd.Show();
        }
        public WrapPanel getCompanysTree()
        {

            return this.CompanyList;
        }
        public TabControl getLeagueTab()
        {
            return this.LeagueTab;
        }
        public MatchData getMatchData()
        {
            return Gooooal_NetDataHelper.matchdataobj;
        }
        public LogBoxList getLogBoxList()
        {
            return this.LogList;
        }
        public Hashtable getCaiPiaoMaths()
        {
            return Gooooal_NetDataHelper.matchdataobj.CaiPiaoMatchList;
        }
        public Dispatcher GetDispatcher()
        {

            return this.Dispatcher;
        }
        public ListView NewListView()
        {
            ListView listview = new ListView();
            //listview.MouseDoubleClick += new MouseButtonEventHandler(listview_MouseDoubleClick);
            listview.ItemContainerStyle = this.Resources["listivewitem"] as Style;
            listview.View = this.Resources["MatchGridView"] as GridView;
            listview.MouseDoubleClick += new MouseButtonEventHandler(listview_MouseDoubleClick);

            return listview;
        }
        public RadioButton NewRadioButton()
        {
            RadioButton rab = new RadioButton();
            rab.Style = this.Resources["RadioButtonStyle"] as Style;
            return rab;
        
        }

        public TabItem getTabItemByName(String name)
        {
            foreach (TabItem tb in this.LeagueTab.Items)
            {
                if (tb.Header as String == name)
                    return tb;
            }
            return null;
        
        }
        public void SetSelectTabByName(String name)
        {
            foreach (TabItem tb in this.LeagueTab.Items)
            {
                if (tb.Header as String == name)
                {
                    this.LeagueTab.SelectedItem = tb;
                    this.LeagueTab.SelectedIndex = this.LeagueTab.Items.IndexOf(tb);
                }
            }
        }

        public void UpdateLastOddsInfo(String info)
        {
            this.lastchgoddsinfo.Content = info;
        }
        // 更新博彩公司选择树,更新比赛场次显示分类
        public void UpdateUI()
        {

            this.logList.Add("UpdateUI");
            // 更新显示左边博彩公司
            foreach (CompanyItem ci in Gooooal_NetDataHelper.matchdataobj.CompanyList.Values)
            {
                foreach (IListenCompany ls in this.listencompanys)
                {
                    ls.OnListenCompany(ci, this);

                }

            }

        

            foreach (MatchItem mi in Gooooal_NetDataHelper.matchdataobj.Matchs.Values)
            {
                foreach (IListenMatchItem ls in this.listenmatchitems)
                {
                    ls.OnListenMathItem(mi, this);

                }

            }

            foreach (IListenMatchItem ls in this.listenmatchitems)
            {
                ls.ListenEnd();
            }

            String selheader = ConfigHelper.GetConfig("LeagueTab_SelectionChanged", "");

            if (selheader.Length > 0)
            {
                foreach (TabItem tb in this.getLeagueTab().Items)
                {
                    if (tb.Header as String == selheader)
                    {
                        this.getLeagueTab().SelectedItem = tb;
                        LogList.Add("SelectedItem:" + tb.Header);
                    }
                }
            }


            foreach (TabItem tb in this.LeagueTab.Items)
            {
                //Console.WriteLine(tb.Header);
                ListView listview = tb.Content as ListView;

                ObservableCollection<MatchListDataTemple> matchlist = listview.ItemsSource as ObservableCollection<MatchListDataTemple>;
                if (matchlist != null && matchlist.Count > 0)
                {
                    var sortlist = matchlist.OrderBy(p => p.lMatchKoTime);
                    matchlist = new ObservableCollection<MatchListDataTemple>(sortlist);
                    
                    listview.ItemsSource = matchlist;
                    
  
                }
                
            }
            
            System.Console.WriteLine("获取赛事数据OK!!");
            LogList.Add("获取赛事数据OK!!");

            timer.Interval = 5000;
            timer.Elapsed += new ElapsedEventHandler(timer1_Tick);
            timer.Start();

        }
        public void GetMatchHistoryDataForFilterOk(IAsyncResult asyncResult)
        {
            String mId = (asyncResult.AsyncState as Bet007_NetDataHelper.OnGetMatchHistoryData).EndInvoke(asyncResult).ToString();
            Bet007_AnalysisData analysis = Bet007_NetDataHelper.bet007_matchdataobj.bet007analydata[mId] as Bet007_AnalysisData;
            if (analysis != null)
            {
                Bet007_Match mi = Bet007_NetDataHelper.bet007_matchdataobj.MatchList[mId] as Bet007_Match;
                foreach (Match_FilterItemBind fi in OddsUntil.FilterList)
                {
                    foreach (IListenFilter ls in this.listenmatchfilter)
                    {
                        ls.OnListenFilter(mi, fi, analysis);

                    }
                }

            }
        }
        public void UpdateFilterMatchs()
        {
            foreach (MatchItem mi in Gooooal_NetDataHelper.matchdataobj.Matchs.Values)
            {
                Bet007_Match tm = Bet007_NetDataHelper.GetMatchDataByName(mi.t1CnName,mi.t2CnName);

                if(tm == null)
                    tm = Bet007_NetDataHelper.GetMatchDataByEnName(mi.t1EnName, mi.t2EnName);

                if (tm != null)
                {
                    Bet007_AnalysisData analysis = Bet007_NetDataHelper.bet007_matchdataobj.bet007analydata[tm.mId] as Bet007_AnalysisData;

                    if (analysis == null)
                    {
                        Bet007_NetDataHelper.OnGetMatchHistoryData onget = new Bet007_NetDataHelper.OnGetMatchHistoryData(Bet007_NetDataHelper.GetMatchHistoryData);
                        onget.BeginInvoke(tm.mId, GetMatchHistoryDataForFilterOk, onget);
                    
                    }
                    else
                    {
                        Bet007_NetDataHelper.OnGetMatchEuropeOdds ongert2 = new Bet007_NetDataHelper.OnGetMatchEuropeOdds(Bet007_NetDataHelper.GetMatchEuropeOdds);

                        ongert2.BeginInvoke(tm.mId, Bet007_NetDataHelper.GetMatchEuropeOddsOk, ongert2);
                    }
                    

                    analysis = Bet007_NetDataHelper.bet007_matchdataobj.bet007analydata[tm.mId] as Bet007_AnalysisData;
                    if (analysis != null)
                    {
                        foreach (Match_FilterItemBind fi in OddsUntil.FilterList)
                        {
                            foreach (IListenFilter ls in this.listenmatchfilter)
                            {
                                ls.OnListenFilter(tm, fi, analysis);

                            }
                        }
                    
                    }

                   
                    

                }

               
                

            }

           
        }
        public void NotifyFilterMatchOk()
        {
            foreach (TabItem tb in this.LeagueTab.Items)
            {
                if (tb.Header as String == OddsUntil.Filter_MatchName)
                {
                    ListView listview = tb.Content as ListView;

                    ObservableCollection<MatchListDataTemple> matchlist = listview.ItemsSource as ObservableCollection<MatchListDataTemple>;
                    if (matchlist != null && matchlist.Count > 0)
                    {
                        var sortlist = matchlist.OrderBy(p => p.lMatchKoTime);
                        matchlist = new ObservableCollection<MatchListDataTemple>(sortlist);

                        listview.ItemsSource = matchlist;

                        OddsUntil.LeagueViewTemple[OddsUntil.Filter_MatchName] = matchlist;
                        

                    }

                
                }

            }
        }
        public void OnNetGetDataOk(String okstr)
        {

            if(okstr == "OnGetMatOddsDataOk")
            {
                
                this.Dispatcher.BeginInvoke((Action)(() =>
                {
                    this.Dispatcher.BeginInvoke((Action)(() => { UpdateUI(); }));
                    this.logList.Add("获取比赛列表成功");
                }));
            
            }
            else if (okstr == "GetMathOddsDataForCaiPiaoOk")
            {
                this.Dispatcher.BeginInvoke((Action)(() =>
                {
                    this.logList.Add("GetMathOddsDataForCaiPiaoOk");
                }));
                
            
            }




        }

        public WrapPanel getOddsChangePanel()
        {
            return this.wrapPanel1;
        }
        void listview_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListView lv = sender as ListView;
            MatchListDataTemple mt = lv.SelectedItem as MatchListDataTemple;
            if (mt != null)
            {
                ShowMatchOddsWnd(mt.mId);
            }
            
            
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //OddsChangeItem oitem = new OddsChangeItem();
            //OddsChangeItemBind oitembind = new OddsChangeItemBind { LeagueName = "英超", HostTeamName = "曼联", HostOdds = "1.2", Panlu = "-1", VisitTeanName = "切尔西", VisitOdds = "0.8" };
            //oitem.Oddschangeitembind = oitembind;
            //wrapPanel1.Children.Add(oitem);

            //OddsChangeItem oitem2 = new OddsChangeItem();
            //oitem2.Oddschangeitembind = oitembind;
            //wrapPanel1.Children.Add(oitem2);

            OddsUntil.initCompany();
            OddsUntil.initVsList();

            OddsUntil.analysiss.Add(Bet007_NetDataHelper.analysistest);

            logicshowallcompany = new ShowAllCompanyLogic();
            logicshowallcompany.Uicontrol = this;
            this.listencompanys.Add(logicshowallcompany);


            //////////////////////////////////////////////
            logicshowmathcaipiao = new ShowMathItemForCaiPiao();
            logicshowmathcaipiao.Uicontrol = this;

            logicshowmathitems = new ShowMathItemLogic();
            logicshowmathitems.Uicontrol = this;
            listenmatchitems = new List<IListenMatchItem>();

            listenmatchitems.Add(logicshowmathitems);
            listenmatchitems.Add(logicshowmathcaipiao);


            filterodds = new FilterOdds();
            filterodds.Uicontrol = this;

            filterhisvs = new FilterHistoryVS();
            filterhisvs.Uicontrol = this;

            filterleaguedata = new FilterLeagueData();
            filterleaguedata.Uicontrol = this;

            filterclosevs = new FilterCloseVS();
            filterclosevs.Uicontrol = this;

            listenmatchfilter.Add(filterodds);
            listenmatchfilter.Add(filterhisvs);
            listenmatchfilter.Add(filterleaguedata);
            listenmatchfilter.Add(filterclosevs);
            //ThemeManager.ApplyTheme(this, "ExpressionDark");

            //String companyodds = "{\"mId\":\"770833\",\"cId\":\"29\",\"oType\":\"a\",\"sId\":\"1\",\"chgTimeUTC\":1324050255,\"chgTime\":null\",\"host\":\"1.83\",\"vs\":\"-10\",\"visit\":\"2.05\",\"period\":\"\",\"vnname\":\"两球半\",\"updatetime\":\"2011-12-16 11:44:15\",\"oddsdata1\":null,\"oddsdata2\":null,\"oddsdata3\":null}{\"mId\":\"770833\",\"cId\":\"29\",\"oType\":\"a\",\"sId\":\"1\",\"chgTimeUTC\":1324050255,\"chgTime\":null\",\"host\":\"1.83\",\"vs\":\"-10\",\"visit\":\"2.05\",\"period\":\"\",\"vnname\":\"两球半\",\"updatetime\":\"2011-12-16 11:44:15\",\"oddsdata1\":null,\"oddsdata2\":null,\"oddsdata3\":null}";
            //Regex r3 = new Regex(".*?}"); //定义一个Regex对象实例
            //MatchCollection mc = r3.Matches(companyodds);

            //for (int i = 0; i < mc.Count; i++)
            //{
            //    Console.WriteLine(mc[i].Value);
            //}

            //String data1 = "var v_data=[['2010-07-03',75,'世界盃','#660000',766,'<span title=\"排名：7\">阿根廷(中)</span>',650,'<span title=\"排名：6\">德国</span>',0,4,'0-1','平/半',1,1,1,406269],['2010-03-04',41,'友誼賽','#00A8A8',650,'<span title=\"排名：6\">德国</span>',766,'<span title=\"排名：8\">阿根廷</span>',0,1,'0-1','平/半',-1,-1,-1,371017],['2006-06-30',75,'世界盃','#660000',650,'<span title=\"排名：19\">德国</span>',766,'<span title=\"排名：9\">阿根廷</span>',1,1,'0-0','平/半',0,-1,-1,81453],['2005-06-22',88,'洲際盃','#009933',650,'<span title=\"排名：A1\">德国</span>',766,'<span title=\"排名：A2\">阿根廷</span>',2,2,'1-1','平手',0,0,1,39094],['2005-02-10',41,'友誼賽','#00A8A8',650,'<span title=\"排名：16\">德国</span>',766,'<span title=\"排名：3\">阿根廷</span>',2,2,'2-1','',0,-2,1,22435]];";

            //MatchCollection mc;
            //Regex r = new Regex("'\\d+-\\d+-\\d+',\\d+,'[\u4e00-\u9fa5]*','#[\\w]*',\\d+,'<span title=\"[\u4e00-\u9fa5]*：\\w+\">[\u4e00-\u9fa5\\w\\(\\)]*</span>',\\d+,'<span title=\"[\u4e00-\u9fa5]*：\\w+\">[\u4e00-\u9fa5\\w]*</span>',\\d,\\d,'\\d+-\\d+','[\u4e00-\u9fa5/]*',-?\\d,-?\\d,-?\\d,\\d+"); //定义一个Regex对象实例
            //mc = r.Matches(data1);
            //Console.WriteLine(mc[0].Value);
            
            //String requesturl = "data/2011/10/matchdata.2011_10_30_d?kuh2xXDyrK";
            #region
            // 初始未来5天选项
            this.LogBox.ItemsSource = LogList;
            //DateTime time = DateTime.Now;
            //TreeViewItem tv1 = new TreeViewItem();
            //tv1.Header = time.ToString("yyyy-MM-dd");
            //tv1.Selected += new RoutedEventHandler(Date_Selected);
            //tv1.DataContext = time;
            //SelectOptionList.Items.Add(tv1);

            //tv1 = new TreeViewItem();
            //time = time.AddDays(1);
            //tv1.Header = time.ToString("yyyy-MM-dd");
            //tv1.Selected += new RoutedEventHandler(Date_Selected);
            //tv1.DataContext = time;
            //SelectOptionList.Items.Add(tv1);

            //tv1 = new TreeViewItem();
            //time = time.AddDays(1);
            //tv1.Header = time.ToString("yyyy-MM-dd");
            //tv1.Selected += new RoutedEventHandler(Date_Selected);
            //tv1.DataContext = time;
            //SelectOptionList.Items.Add(tv1);

            //tv1 = new TreeViewItem();
            //time = time.AddDays(1);
            //tv1.Header = time.ToString("yyyy-MM-dd");
            //tv1.Selected += new RoutedEventHandler(Date_Selected);
            //tv1.DataContext = time;
            //SelectOptionList.Items.Add(tv1);

            //tv1 = new TreeViewItem();
            //time = time.AddDays(1);
            //tv1.Header = time.ToString("yyyy-MM-dd");
            //tv1.Selected += new RoutedEventHandler(Date_Selected);
            //tv1.DataContext = time;
            //SelectOptionList.Items.Add(tv1);

           
            #endregion
            // 开始异步调用获取网站数据

            String json = ConfigHelper.GetConfig("Main_GridSplitter_DragCompleted", "");

            if (json.Length > 0)
            {
                List<String> widths = JsonConvert.DeserializeObject<List<String>>(json);

                int index = 0;
                foreach (ColumnDefinition c in this.maichgrid.ColumnDefinitions)
                {
                    
                    GridLength gw = (GridLength)(new GridLengthConverter()).ConvertFromString(widths[index]);
                    c.Width = gw;
                    index++;
                }


            }
            Gooooal_NetDataHelper.Init(this);

            Bet007_NetDataHelper.Init(this);

           
        }

        void Date_Selected(object sender, RoutedEventArgs e)
        {
            TreeViewItem tv = sender as TreeViewItem;
            DateTime time = (DateTime)tv.DataContext;
            StringBuilder strbuilder = new StringBuilder();
            strbuilder.Append("http://odds.gooooal.com/data/");
            strbuilder.Append(time.ToString("yyyy"));
            strbuilder.Append("/");
            strbuilder.Append(time.ToString("MM"));
            strbuilder.Append("/");
            strbuilder.Append("matchdata.");
            strbuilder.Append(time.ToString("yyyy"));
            strbuilder.Append("_");
            strbuilder.Append(time.ToString("MM"));
            strbuilder.Append("_");
            strbuilder.Append(time.ToString("dd"));
            strbuilder.Append("_");
            strbuilder.Append("d?");
            strbuilder.Append(OddsUntil.GetRandStr(10));

            Gooooal_NetDataHelper.OnGetMatOddsData onget = new Gooooal_NetDataHelper.OnGetMatOddsData(Gooooal_NetDataHelper.GetMatOddsData);
            Console.WriteLine(strbuilder.ToString());
            onget.BeginInvoke(strbuilder.ToString(), Gooooal_NetDataHelper.OnGetMatOddsDataOk, onget);
        }
        
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //MatchContaner.Children.Clear();
            //Button button = (Button)sender;
            //foreach (MatchItem matchitem in matchdataobj.MatchList.Values)
            //{
            //    LeagueItem getleagueitem = (LeagueItem)matchdataobj.LeagueList[matchitem.lId];
            //    if ((getleagueitem != null && getleagueitem.cnName.IndexOf((String)button.DataContext) != -1) || (String)button.DataContext == "*")
            //    {
            //        MatchControl m1 = new MatchControl();
            //        m1.VerticalAlignment = VerticalAlignment.Top;
            //        m1.Margin = new Thickness(5);
            //        m1.mainuicontrol = this;

            //        MatchDataTemplate m2 = new MatchDataTemplate();
            //        m2.main_team_name = matchitem.t1CnName;
            //        m2.client_team_name = matchitem.t2CnName;
            //        m2.matchitem = matchitem;


            //        m2.league_match_name = getleagueitem.cnName;

            //        m1.DataContext = m2;


            //        MatchContaner.Children.Add(m1);
            //    }
              
                
               
            //}
        }

        private void LeagueTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

            TabControl sl = sender as TabControl;
            TabItem sb = sl.SelectedItem as TabItem;

            if (sb != null && sb.Header as String != "其他")
            {
                if (OddsUntil.tabdefaultdefault == null)
                {
                    OddsUntil.tabdefaultdefault = sb.Background ;
                }

                sb.Background = OddsUntil.tabdefaultdefault;


            }
            if(e.AddedItems.Count != 0 && e.RemovedItems.Count != 0)
                ConfigHelper.SetConfig("LeagueTab_SelectionChanged", sb.Header as String);
        }

        private void button1_Click2(object sender, RoutedEventArgs e)
        {

            foreach (TabItem tb in this.LeagueTab.Items)
            {

                ListView lv = tb.Content as ListView;



                ObservableCollection<MatchListDataTemple> matchlist = lv.ItemsSource as ObservableCollection<MatchListDataTemple>;


                if (matchlist == null)
                {
                    continue;
                }
                foreach (MatchListDataTemple md in matchlist)
                {
                    md.Odds_a_host_color = "#008B8B";

                }
            }
        }
        private void MenuFilterItemTest_Click(object sender, RoutedEventArgs e)
        {

           
            
            UpdateFilterMatchs();
        }
        private void MenuFilterItem_Click(object sender, RoutedEventArgs e)
        {
            Boolean badd = false;
            foreach (TabItem tb in getLeagueTab().Items)
            {
                if (tb.Header as String == OddsUntil.Filter_MatchName)
                {
                    badd = true;
                }
            }
            if(!badd)
            {
                TabItem tb = new TabItem();
                ListView listview = NewListView();

                ObservableCollection<MatchListDataTemple> matchlist = new ObservableCollection<MatchListDataTemple>();
                listview.ItemsSource = matchlist;

                

                tb.Content = listview;
                tb.Header = OddsUntil.Filter_MatchName;
                tb.DataContext = OddsUntil.Filter_MatchName;
                this.getLeagueTab().Items.Add(tb);

                OddsUntil.LeagueViewTemple[tb.DataContext as String] = matchlist;
            }


            wnd.Uicontrol = this;
            wnd.Show();
                     
        }
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {

          
             
        }
        private void MenuItem_Themes(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            String struri = String.Format(@"WPF.Themes/{0}/Theme.xaml",item.Header);
            ResourceDictionary dictionary = Application.LoadComponent(new Uri(struri, UriKind.Relative)) as ResourceDictionary;

            if (dictionary != null)
            {
                this.Resources.MergedDictionaries.Clear();
                this.Resources.MergedDictionaries.Add(dictionary);
            }
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            this.wnd.Close();
            this.timer.Stop();
            Application.Current.Shutdown();
        }

        private void GridSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
        {
            List<String> widths = new List<String>();
            foreach (ColumnDefinition c in this.maichgrid.ColumnDefinitions)
            {
                widths.Add(c.Width.ToString());
            }
            String json = JsonConvert.SerializeObject(widths);

            ConfigHelper.SetConfig("Main_GridSplitter_DragCompleted", json);

        }

        public void StartTimeTick()
        {
            this.timer.Start();
        }

        public void StopTimeTick()
        {
            this.timer.Stop();
        }

        private void AnalysisMatchData(object sender, RoutedEventArgs e)
        {
            foreach (IAnalysis aly in OddsUntil.analysiss)
            {
                foreach (DictionaryEntry  de in Bet007_NetDataHelper.bet007_matchdataobj.bet007analydata)
                {
                    aly.OnAnalysis(de.Key as String, de.Value as Bet007_AnalysisData);
                }
            }
        }
    }
    public class LogBoxList : ObservableCollection<String>
    {
        public LogBoxList()
        {

        }
    }
   
}
